package org.bird.jvm;

import java.lang.reflect.Method;

import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

/**
 * @Described：堆内存溢出探究
 * @VM args : -XX:PermSize=5M -XX:MaxPermSize=5M -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError
 * @author liangjf
 *
 */
public class MethodAreaOutOfMemory {

	public static void main(String[] args) {
		while (true) {
			Enhancer enhancer = new Enhancer();
			enhancer.setSuperclass(TestCase.class);
			enhancer.setUseCache(false);
			enhancer.setCallback(new MethodInterceptor() {

				public Object intercept(Object obj, Method method,
						Object[] args, MethodProxy proxy) throws Throwable {
					return proxy.invokeSuper(obj, args);
				}
			});
			enhancer.create();
		}
	}

	/**
	 * @Described 测试用例
	 * @author liangjf
	 *
	 */
	static class TestCase {
		
	}
}
